import http from '@/utils/http'

const BASE_URL = '/cakerun/store-sales-statistics'

export interface StoreSalesRatingStatisticsResp {
  serialNumber: number
  shopName: string
  cakeSize: string
  cakeCount: string
  cakeAmount: string
  bakeryCount: number
  bakeryAmount: number
  voucherCount: number
  voucherAmount: number
  isTotal: boolean
}

export interface StoreSalesRatingStatisticsReq {
  shopIds?: number[]
  statisticsDate: string
  accountIds?: string[]
  city?: string
}

export function fetchStoreSalesRatingStatistics(query: StoreSalesRatingStatisticsReq) {
  return http.get<StoreSalesRatingStatisticsResp[]>(`${BASE_URL}/list`, query)
}

export function exportStoreSalesRatingStatistics(query: StoreSalesRatingStatisticsReq) {
  return http.download(`${BASE_URL}/export`, query)
}
